| @@ -0,0 +1,20 @@ | ||
| 1 | +# -*- coding: utf-8 -*- | |
| 2 | + | |
| 3 | +# Generated by Django 3.2.16 on 2024-04-10 08:12 | |
| 4 | + | |
| 5 | +from django.db import migrations, models | |
| 6 | + | |
| 7 | + | |
| 8 | +class Migration(migrations.Migration): | |
| 9 | + | |
| 10 | + dependencies = [ | |
| 11 | +        ('account', '0061_auto_20240327_1550'), | |
| 12 | + ] | |
| 13 | + | |
| 14 | + operations = [ | |
| 15 | + migrations.AddField( | |
| 16 | + model_name='lensmaninfo', | |
| 17 | + name='remark', | |
| 18 | + field=models.CharField(blank=True, help_text='备注', max_length=255, null=True, verbose_name='remark'), | |
| 19 | + ), | |
| 20 | + ] | 
| @@ -384,6 +384,8 @@ class LensmanInfo(BaseModelMixin): | ||
| 384 | 384 | name = models.CharField(_(u'name'), max_length=255, blank=True, null=True, help_text=u'摄影师姓名') | 
| 385 | 385 | phone = models.CharField(_(u'phone'), max_length=11, blank=True, null=True, help_text=u'摄影师联系电话') | 
| 386 | 386 | integral = models.IntegerField(_(u'integral'), default=0, help_text=u'摄影师积分') | 
| 387 | + remark = models.CharField(_(u'remark'), max_length=255, blank=True, null=True, help_text=u'备注') | |
| 388 | + | |
| 387 | 389 |  | 
| 388 | 390 | lensman_status = models.IntegerField(_(u'lensman_status'), choices=LENSMAN_STATUS, default=UNVERIFIED, help_text=u'摄影师状态', db_index=True) | 
| 389 | 391 |  | 
| @@ -432,6 +434,7 @@ class LensmanInfo(BaseModelMixin): | ||
| 432 | 434 | 'start_date': self.start_date, | 
| 433 | 435 | 'end_date': self.end_date, | 
| 434 | 436 | 'is_expired': self.is_expired, | 
| 437 | + 'remark': self.remark, | |
| 435 | 438 | 'created_at': tc.local_string(utc_dt=self.created_at), | 
| 436 | 439 | } | 
| 437 | 440 |  | 
| @@ -65,6 +65,7 @@ def lensman_update(request, administrator): | ||
| 65 | 65 |      end_date = tc.to_date(request.POST.get('end_date', '')) | 
| 66 | 66 |      name = request.POST.get('name', '') | 
| 67 | 67 |      phone = request.POST.get('phone', '') | 
| 68 | +    remark = request.POST.get('remark', '') | |
| 68 | 69 |  | 
| 69 | 70 | try: | 
| 70 | 71 | lensman = LensmanInfo.objects.get(lensman_id=lensman_id, status=True) | 
| @@ -75,6 +76,7 @@ def lensman_update(request, administrator): | ||
| 75 | 76 | lensman.end_date = end_date | 
| 76 | 77 | lensman.name = name | 
| 77 | 78 | lensman.phone = phone | 
| 79 | + lensman.remark = remark | |
| 78 | 80 |  | 
| 79 | 81 | lensman.save() | 
| 80 | 82 |  | 
| @@ -63,8 +63,8 @@ def activity_integral_add(request, administrator): | ||
| 63 | 63 | except LensmanInfo.DoesNotExist: | 
| 64 | 64 |          return response('400001', 'LensmanInfo Not Found', '摄影师不存在') | 
| 65 | 65 |  | 
| 66 | - user.integral += integral | |
| 67 | - user.save() | |
| 66 | + lensman.integral += integral | |
| 67 | + lensman.save() | |
| 68 | 68 |  | 
| 69 | 69 | LensmanIntegralIncomeExpensesInfo.objects.create( | 
| 70 | 70 | brand_id=brand_id, | 
| @@ -6,7 +6,7 @@ from django.db.models import Q | ||
| 6 | 6 | from django_response import response | 
| 7 | 7 |  | 
| 8 | 8 | from account.models import LensmanInfo | 
| 9 | -from member.models import MemberActivityInfo, MemberActivityDataInfo, MemberActivitySignupInfo | |
| 9 | +from member.models import MemberActivityInfo, MemberActivityDataInfo, MemberActivitySignupInfo, MemberActivityContributionInfo | |
| 10 | 10 | from utils.error.errno_utils import MemberActivityStatusCode | 
| 11 | 11 |  | 
| 12 | 12 | @logit | 
| @@ -58,25 +58,34 @@ def activity_data_detail(request): | ||
| 58 | 58 |  | 
| 59 | 59 |  | 
| 60 | 60 | @logit | 
| 61 | -def activity_signup_message(request): | |
| 61 | +def activity_message(request): | |
| 62 | 62 |      user_id = request.POST.get('user_id', '') | 
| 63 | 63 |  | 
| 64 | 64 |      lensman_acts = MemberActivityInfo.objects.values_list('activity_id', flat=True).filter(activity_section=4, status=True) | 
| 65 | - infos = MemberActivitySignupInfo.objects.filter(Q(user_id=user_id) & Q(activity_id__in=lensman_acts) & Q(is_read=False)).exclude(audit_status=MemberActivitySignupInfo.UNAUDITED) | |
| 65 | + signup_infos = MemberActivitySignupInfo.objects.filter(Q(user_id=user_id) & Q(activity_id__in=lensman_acts) & Q(is_read=False)).exclude(audit_status=MemberActivitySignupInfo.UNAUDITED) | |
| 66 | + contribution_infos = MemberActivityContributionInfo.objects.filter(Q(user_id=user_id) & Q(activity_id__in=lensman_acts) & Q(is_read=False)).exclude(audit_status=MemberActivityContributionInfo.UNAUDITED) | |
| 66 | 67 |  | 
| 67 | - infos = [info.data for info in infos] | |
| 68 | + signup_infos = [signup_infos.data for info in signup_infos] | |
| 69 | + contribution_infos = [contribution_infos.data for info in contribution_infos] | |
| 68 | 70 |  | 
| 69 | 71 |      return response(data={ | 
| 70 | - 'messages': infos | |
| 72 | + 'signup_messages': signup_infos, | |
| 73 | + 'contribution_messages': contribution_infos, | |
| 71 | 74 | }) | 
| 72 | 75 |  | 
| 76 | + | |
| 73 | 77 | @logit | 
| 74 | -def activity_signup_message_read(request): | |
| 78 | +def activity_message_read(request): | |
| 75 | 79 |      user_id = request.POST.get('user_id', '') | 
| 76 | 80 |      signup_id = request.POST.get('signup_id', '') | 
| 81 | +    contribution_id = request.POST.get('contribution_id', '') | |
| 82 | + | |
| 83 | + if signup_id: | |
| 84 | + MemberActivitySignupInfo.objects.filter(user_id=user_id, signup_id=signup_id).update(is_read=True) | |
| 85 | + | |
| 86 | + if contribution_id: | |
| 87 | + MemberActivityContributionInfo.objects.filter(user_id=user_id, contribution_id=contribution_id).update(is_read=True) | |
| 77 | 88 |  | 
| 78 | - MemberActivitySignupInfo.objects.filter(user_id=user_id, signup_id=signup_id).update(is_read=True) | |
| 89 | + return response(200, 'Activity Message Has Read Success', '活动消息已读') | |
| 79 | 90 |  | 
| 80 | - return response(200, 'Activity Signup Message Has Read Success', '活动报名消息已读') | |
| 81 | 91 |  | 
| 82 | - | 
| @@ -0,0 +1,25 @@ | ||
| 1 | +# -*- coding: utf-8 -*- | |
| 2 | + | |
| 3 | +# Generated by Django 3.2.16 on 2024-04-10 08:12 | |
| 4 | + | |
| 5 | +from django.db import migrations, models | |
| 6 | + | |
| 7 | + | |
| 8 | +class Migration(migrations.Migration): | |
| 9 | + | |
| 10 | + dependencies = [ | |
| 11 | +        ('member', '0070_auto_20240327_1550'), | |
| 12 | + ] | |
| 13 | + | |
| 14 | + operations = [ | |
| 15 | + migrations.AddField( | |
| 16 | + model_name='memberactivitycontributioninfo', | |
| 17 | + name='is_read', | |
| 18 | + field=models.BooleanField(default=False, help_text='审核消息是否已读', verbose_name='is_read'), | |
| 19 | + ), | |
| 20 | + migrations.AlterField( | |
| 21 | + model_name='memberactivitycontributioninfo', | |
| 22 | + name='audit_status', | |
| 23 | + field=models.IntegerField(choices=[(0, '未审核'), (1, '已通过'), (2, '未通过')], db_index=True, default=0, help_text='审批状态', verbose_name='audit_status'), | |
| 24 | + ), | |
| 25 | + ] | 
| @@ -913,11 +913,14 @@ class MemberActivityContributionInfo(BaseModelMixin, BrandInfoMixin): | ||
| 913 | 913 | # (2, u'入围'), | 
| 914 | 914 | ) | 
| 915 | 915 |  | 
| 916 | - AUDIT_PASS = 1 | |
| 916 | + UNAUDITED = 0 | |
| 917 | + PASSED = 1 | |
| 918 | + UNPASSED = 2 | |
| 919 | + | |
| 917 | 920 | AUDIT_STATUS = ( | 
| 918 | - (0, u'未审批'), | |
| 919 | - (1, u'已通过'), | |
| 920 | - (2, u'未通过'), | |
| 921 | + (UNAUDITED, '未审核'), | |
| 922 | + (PASSED, '已通过'), | |
| 923 | + (UNPASSED, '未通过'), | |
| 921 | 924 | ) | 
| 922 | 925 |  | 
| 923 | 926 | contribution_id = ShortUUIDField(_(u'contribution_id'), max_length=32, blank=True, null=True, help_text=u'投稿唯一标识', db_index=True, unique=True) | 
| @@ -946,6 +949,9 @@ class MemberActivityContributionInfo(BaseModelMixin, BrandInfoMixin): | ||
| 946 | 949 | audit_status = models.IntegerField(_(u'audit_status'), choices=AUDIT_STATUS, default=0, help_text=u'审批状态', db_index=True) | 
| 947 | 950 | is_selected = models.BooleanField(_(u'is_selected'), default=False, help_text=u'是否入围') | 
| 948 | 951 |  | 
| 952 | + is_read = models.BooleanField(_(u'is_read'), default=False, help_text=u'审核消息是否已读') | |
| 953 | + | |
| 954 | + | |
| 949 | 955 | class Meta: | 
| 950 | 956 | verbose_name = _(u'会员活动投稿信息') | 
| 951 | 957 | verbose_name_plural = _(u'会员活动投稿信息') | 
| @@ -39,6 +39,6 @@ urlpatterns += [ | ||
| 39 | 39 |  | 
| 40 | 40 | #activity message | 
| 41 | 41 | urlpatterns += [ | 
| 42 | - url(r'^member/activity/signup/message$', lensman_activity_mp_views.activity_signup_message, name='mp_member_activity_signup_message'), | |
| 43 | - url(r'^member/activity/signup/message/read$', lensman_activity_mp_views.activity_signup_message_read, name='mp_member_activity_signup_message_read'), | |
| 42 | + url(r'^member/activity/message$', lensman_activity_mp_views.activity_message, name='mp_member_activity_message'), | |
| 43 | + url(r'^member/activity/message/read$', lensman_activity_mp_views.activity_message_read, name='mp_member_activity_message_read'), | |
| 44 | 44 | ] |